package com.fresh.liangyi.controller.client;

import com.fresh.liangyi.model.domain.Menu;
import com.fresh.liangyi.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@RequestMapping("/menu")
@Controller
public class MenuController {
    @Autowired
    private MenuService menuService;
    @GetMapping("/{id}")
    public String menu(Model model,
                       @PathVariable Integer id){
        Menu menu=menuService.selectMenuById(id);
        model.addAttribute("menu",menu);
        return "client/menuDetails";
    }
}
